#ifndef _RATIONAL_
#define _RATIONAL_

class Rational {

    int nominator;
    int denominator;

public:
    Rational(const Rational& r);
    Rational(int nominator, int denominator = 1);

    Rational& operator =(const Rational& r);
    Rational& operator +=(const Rational& r);
    Rational& operator -=(const Rational& r);
    Rational& operator *=(const Rational& r);
    Rational& operator /=(const Rational& r);
    Rational& operator ++();
    Rational operator ++(int);
    Rational& operator --();
    Rational operator --(int);
    int get_nominator() const;
    int get_denominator() const;

    operator double ();

private:
    void normalize();
    void sw(Rational &r);

};

Rational operator+ (const Rational& a, const Rational& b);
Rational operator- (const Rational& a, const Rational& b);
Rational operator* (const Rational& a, const Rational& b);
Rational operator/ (const Rational& a, const Rational& b);

bool operator== (const Rational& a, const Rational& b);
bool operator!= (const Rational& a, const Rational& b);
bool operator<= (const Rational& a, const Rational& b);
bool operator>= (const Rational& a, const Rational& b);
bool operator<  (const Rational& a, const Rational& b);
bool operator>  (const Rational& a, const Rational& b);

int gcd(int a, int b);

#endif